import React, { Component } from 'react';
import { Tab } from '@icedesign/base';
import FeatureAnalysisPage from '../FeatureAnalysisPage/FeatureAnalysisPage';

import './CreditRisk.scss';
import { GetUrlParam } from '../../baseConfig';

const TabPane = Tab.TabPane;

export default class CreditRisk extends Component {
  static displayName = 'BusinessPerformance';

  constructor(props) {
    super(props);
    this.state = {
      activeKey: 3,
    };
  }

  componentDidMount() {
    window.onload=function(){
        document.onkeydown=function(){
            var e=window.event||arguments[0];
            if(e.keyCode==123){
                return false;
            }else if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==73)){
                return false;
            }
        };
        document.oncontextmenu=function(){
            return false;
        }
    }
  }

  stabChange = (key) => {
    if(key==0){
      window.location.href = `${global.constants.GOLDEYELOCALHOST}gdBeta2/#/earlyWarning/shortAnswerB?secu_code=${GetUrlParam("secu_code")}`
    }else if(key==1){
      window.location.href = `${global.constants.GOLDEYELOCALHOST}gdBeta2/#/earlyWarning/shortAnswerM?secu_code=${GetUrlParam("secu_code")}`
    }else if(key==2){
      window.location.href = `${global.constants.GOLDEYELOCALHOST}gdBeta2/#/earlyWarning/shortAnswerZ?secu_code=${GetUrlParam("secu_code")}`
    }
  }


  render() {
    return (
      <div>
        {/* <FeatureAnalysisPage /> */}
        <Tab prefix="pre-" onChange={this.stabChange.bind(this)} defaultActiveKey={3}>
          <TabPane tab="本福特异常指数" key={0}>
          </TabPane>

          <TabPane tab="M-score操纵指数" key={1}>
          </TabPane>

          <TabPane tab="Altman-Z指数" key={2}>
          </TabPane>
          <TabPane tab="特征分析" key={3}>
            <FeatureAnalysisPage />
          </TabPane>
        </Tab>
      </div>
    );
  }
}
